pp108 : Using Send Notification Action

Using Send Notification Action

This topic describes the procedure to attach a notification to a rule.

This task applies while defining the action of a rule, a decision table, or creating an action template. Depending upon the validations/conditions you set on the schema, you can send notifications to a particular role apprising him of these validations.


Important: For using Send Notification action in a decision table or an action template, perform steps 3 to step 6.

  1. In the Rule Definition pane, right-click then > Actions > Send Notification. An Action - Send Notification text box is displayed.
  2. Type the name of the action in the Action Name text box. For more information on naming the action, refer to Guidelines for naming rule actions.
  3. To select the role do the following:
    1. Click next to the Roles text box. A Select Roles dialog box appears displaying All Roles List.
    2. Select the role/s and click . The selected users are displayed in the Inbox Recipients text box.
    3. click OK. The selected roles are displayed in the Roles text box separated by semi-colons.
  4. Type the URL of the application or Web page you want to load in the Url to Load text box. For example, if the application is using XForm, type the URL of the xform as /cordys/Orderdetails.caf. When user opens the message in the Inbox, this xform or htm page is displayed.
  5. Type a description for the title of the URL page in the Description text box.
  6. In the Message text box, provide the data to be displayed in the application, in XML format. Alternatively, if you want to use the business object attributes, you can click Insert tab on the editor, select Schema Fragment and drag the required attributes onto the Message text box. The procedure to display the message data in the Notification that is sent to the user's Inbox is explained with the help of the following example: Let us assume that there is an Order object with OrderID and OrderQty as elements. When the rule is executed, the notification that is sent to the user opens an application that contains the OrderId and OrderQty fields. In order to display the data in these fields, do the following:
    1. Provide the OrderID and OrderQty elements in the Message text box. Alternatively, you can drag the OrderID and OrderQty elements from the Schema Fragment section of the Insert tab on the editor, to the corresponding elements in the Messagetext box. The sample message is as shown below:
      <Order>
          <OrderID>
              <path>Order/OrderID</path>
          </OrderID>
          <OrderQty>
              <path>Order/OrderQty</path>
          </OrderQty>
      </Order>
      


      Note: To use the business attribute values in the input message, the
      Order ID and
      OrderQty elements of the business object must be enclosed in <path> tags.

      When the rule is successfully executed, this notification message is sent to the user's Inbox.

    2. To display the values in the message when the user opens the notification in the Inbox, do the following:

    • On initialization of the application, access the input message data using the application.event.data property, as shown below:
      // namespace for xpath expression to select the input message
      var namespaces = {wfl:"http://schemas.cordys.com/notification/workflow/1.0"};
      // select the parent node of the input message data
      var messageData = cordys.selectXMLNode(application.event.data, ".//wfl:Order", namespaces);
      // get the actual values
      var OrderID = cordys.getNodeText(messageData, ".//wfl:OrderID", null, namespaces);
      var OrderQty = cordys.getNodeText(messageData, ".//wfl:OrderQty", null, namespaces);
    • Bind this data to the corresponding fields in your application.
  7. Click Add. The type of action along with the name is displayed next to then in the Rule Definition pane. Repeat the task to add more than one Inbox action to the rule.
    The action is set on the object and on successful validation of the object, a notification is sent to the inbox of the assigned role with the specified message.